﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace HgRemoteServer.Config
{
	public class RepositoryTaskCollection : ConfigurationElementCollection, IEnumerable<RepositoryTask>
	{
		protected override ConfigurationElement CreateNewElement()
		{
			return new RepositoryTask();
		}

		protected override object GetElementKey(ConfigurationElement element)
		{
			return (element as RepositoryTask).Name;
		}

		public override ConfigurationElementCollectionType CollectionType
		{
			get { return ConfigurationElementCollectionType.BasicMap; }
		}

		protected override string ElementName
		{
			get { return "Task"; }
		}

		public new IEnumerator<RepositoryTask> GetEnumerator()
		{
			return this.OfType<RepositoryTask>().GetEnumerator();
		}
	}
}
